i think u havent understood concept of function.
the variable in function are limited to use within function only unless u have defined them global.
so here $echeck is existing onlytill function executes then it expires.
here u would like to use the return value. that would be better.
so tweak ur code like this./
<?
//email_check.php
function emailcheck($intext) {
$theresults = ereg("^[^@ ]+@[^@ ]+.[^@ .]+$", $intext, $trashed);
if ($theresults) { return true;} else { return false; }// u would like to use boolean value for such use. dont u ??
}
?>
and in ur script
?
include("email_check.php");
if( emailcheck($email))
{
echo "yes";
}
else {
echo "no";
}
and yeah a more comprehensive email vaildating syntax can be found here (http://www.php.net/manual/en/function.ereg.php). check out the user comments.
hope it helps,
jd